﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
namespace ZhaoPin.Supervisor
{
    public partial class ResetPassword : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void gridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("Reset"))
            {
                Guid guid = Guid.Parse(e.CommandArgument.ToString());
                MembershipUser user=Membership.GetUser(guid);
                user.ChangePassword(user.GetPassword(), tbPassword.Text);
                ClientScript.RegisterStartupScript(this.GetType(), "message", @"alert('用户" + user.UserName + "的密码已经重置为：" + tbPassword.Text + "');",true);
            }
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            RecruitContainer rc = new RecruitContainer();
            var m = from p in rc.People where p.IdentityCardNumber.Equals(tbIdentity.Text) select p;
            gridView.DataSource = m;
            gridView.DataBind();
            rc.Dispose();
        }
    }
}